package cn.dgiot.fd;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class ServiceApplication extends SpringBootServletInitializer{
	 
	@Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(ServiceApplication.class);
    }

    public static void main(String[] args) {
    	
    	SpringApplication springApplication = new SpringApplication(ServiceApplication.class);
    	ConfigurableApplicationContext run = springApplication.run(args);
        // 加载启动监听
    	AliyunInit aliyunInit = (AliyunInit)run.getBean("aliyunInit");
    	springApplication.addListeners(aliyunInit); 
    }
}
